package com.zmn.plat.services.impl.channel.commission.settle.rule;

import com.zmn.plat.model.entity.channel.commission.settle.rule.ChannelCommissionSettleRule;
import com.zmn.plat.model.entity.channel.commission.settle.rule.ChannelCommissionSettleRuleQuery;
import com.zmn.plat.persistence.interfaces.channel.commission.settle.rule.ChannelCommissionSettleRuleDao;
import com.zmn.plat.services.interfaces.channel.commission.settle.rule.ChannelCommissionSettleRuleService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;


/**
 * 渠道佣金结算规则Service实现类
 *
 * @author linfeng
 *
 * @since 2020/10/26 10:31
 */
@Service
public class ChannelCommissionSettleRuleServiceImpl implements ChannelCommissionSettleRuleService {

    @Resource
    ChannelCommissionSettleRuleDao channelCommissionSettleRuleDao;

    @Override
    public ChannelCommissionSettleRule findByKey(Integer relateId) {
        return channelCommissionSettleRuleDao.findByKey(relateId);
    }

    @Override
    public ChannelCommissionSettleRule findByChannelId(Integer channelId) {
        return channelCommissionSettleRuleDao.findByChannelId(channelId);
    }

    @Override
    public List<ChannelCommissionSettleRule> listPageByQuery(ChannelCommissionSettleRuleQuery query) {
        int count = countByQuery(query);
        query.setTotalCount(count);
        return channelCommissionSettleRuleDao.listPageByQuery(query);
    }

    @Override
    public List<ChannelCommissionSettleRule> listByQuery(ChannelCommissionSettleRuleQuery query) {
        return channelCommissionSettleRuleDao.listByQuery(query);
    }

    @Override
    public List<ChannelCommissionSettleRule> listAll() {
        return channelCommissionSettleRuleDao.listAll();
    }

    @Override
    public Integer countByQuery(ChannelCommissionSettleRuleQuery query) {
        return channelCommissionSettleRuleDao.countByQuery(query);
    }
    @Override
    public Integer updateByKey(ChannelCommissionSettleRule channelCommissionSettleRule) {
        return channelCommissionSettleRuleDao.updateByKey(channelCommissionSettleRule);
    }

    @Override
    public Integer insert(ChannelCommissionSettleRule channelCommissionSettleRule) {
        return channelCommissionSettleRuleDao.insert(channelCommissionSettleRule);
    }

    @Override
    public Integer deleteByKey(Integer relateId) {
        return channelCommissionSettleRuleDao.deleteByKey(relateId);
    }

    @Override
    public void copy(Integer originalChannelId, int targetChannelId, String operator) {

        channelCommissionSettleRuleDao.copy(originalChannelId, targetChannelId, operator);
    }

}